/**
 * 请求前缀，后面后台添加网关后需要前缀选择微服务
 */
import { sessionFallbackRequestGet } from '@/utils/Request'

const URL_PREFIX = 'middle-goods/'

/**
 * 获取首页走马灯数据
 * @param {Boolean} refresh 是否是刷新操作
 * @param {Function} successCallback 成功回调，参数为data
 * @param {Function} fullCallback 肯定触发的回调，先于callback
 */
export const queryCarouselVO = (refresh = false, successCallback = null, fullCallback = null) => {
  return sessionFallbackRequestGet(URL_PREFIX + 'pageIndexController/queryCarouselVO', {}, {},
    6 * 60 * 60, refresh, true, data => {
      if (successCallback) {
        successCallback(data)
      }
    }, null, fullCallback)
}

/**
 * 获取首页Featured数据
 * @param {Boolean} refresh 是否刷新
 * @param {Function} successCallback 成功回调，参数为data
 * @param {Function} fullCallback 肯定触发的回调，先于callback
 */
export const queryFeaturedVO = (refresh = false, successCallback = null, fullCallback = null) => {
  return sessionFallbackRequestGet(URL_PREFIX + 'pageIndexController/queryFeaturedVO', {}, {},
    6 * 60 * 60, refresh, true, data => {
      if (successCallback) {
        successCallback(data)
      }
    }, null, fullCallback)
}
